package com.cn.algorithm.one.list;

public class Dequeue<E> {

    List<E> list = new LinkedList<>();

    public int size() {
        return list.size();
    }

    public boolean isEmpty() {
        return list.isEmpty();
    }

    public void clear() {
        list.clear();
    }

    public E front() {
        return list.get(0);
    }

    public E tail() {
        return list.get(list.size() - 1);
    }

    public E leftPop() {
        return list.remove(0);
    }

    public E rightPop() {
        return list.remove(list.size() - 1);
    }

    public void rightPush(E element) {
        list.add(element);
    }

    public void leftPush(E element) {
        list.add(0, element);
    }
}
